﻿using System;
using System.Collections.Generic;
using System.Text;
using UmlDesigner.Gui;

namespace UmlDesigner.Model.WorkUnits
{
    class ChangeClassStateWorkUnit : IWorkUnit
    {
        ClassWidget targetWidget;
        ClassWidget desiredChange;
        ClassWidget oldState;

        internal ChangeClassStateWorkUnit(ClassWidget target, ClassWidget change)
        {
            oldState = new ClassWidget();
            desiredChange = change;
            targetWidget = target;
        }

        #region IWorkUnit Members

        public void Do(UmlControl umlControl)
        {
            targetWidget.ShallowCopyClassWidget(oldState);
            desiredChange.ShallowCopyClassWidget(targetWidget);
        }

        public void Undo(UmlControl umlControl)
        {
            oldState.ShallowCopyClassWidget(targetWidget);
        }

        #endregion
    }
}
